﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Adex;
using MediaMonitor.Common;

namespace MediaMonitor.Admin
{
    public partial class ChangeEmailPassword : Adex.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
               
            }
        }

        protected void btnChangePassword_Click(object sender, ImageClickEventArgs e)
        {
            DataTable dt = SPs.GetAllEmailPassword(lblEmail.Text, txtOldPassword.Text).GetDataSet().Tables[0];
            if (dt.Rows.Count > 0)
            {
                lblErrorMsg.Text = "Password has been changed successfully.";
                lblErrorMsg.Style.Add("color", "green");
                lblErrorMsg.Visible = true;
                SPs.GetAllEmailPasswordUpdate(txtNewPassword.Text, DateTime.Now).ExecuteScalar();
            }
            else {
                lblErrorMsg.Text = "Invalid Current Password";
                lblErrorMsg.Style.Add("color", "red");
                lblErrorMsg.Visible = true;
            }
        }

    }
}